<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>



<%
    ArrayList<String> person = new ArrayList<>();
    person.add(0,"name1");
    person.add(1,"name2");
    person.add(2,"name3");
    person.add(3,"name4");
    person.add(4,"name5");
    request.setAttribute("list",person);
%>

<%--
var,每一次遍历出来的变量
items,要遍历出来的对象
--%>

<c:forEach var="person" items="${list}">
    <c:out value="${person}"/> <br>
</c:forEach>

<hr>

<c:forEach var="person" items="${list}" begin="1" end="3" step="2">
    <c:out value="${person}"/>  <br>
</c:forEach>

<%--
begin,那里开始
end,那里结束
step,步长
--%>

</body>
</html>
